Cleaned up code to follow Galler2 coding guidelines