Clean up formatting and add some documentation