Clean up formatting and add comments