Clean up code and add comments
Clean up code and add comments