Clean up the code, and make it conform to guidelines