Formatting and minor fixes and cleanup