Clean up some code formatting and fix #1