Code formatting cleanup

Main code rev. 1831