clean up code and formatting