Fix a few code and formatting mistakes