Clean up the code to make it proper