Further cleanup and code formatting

Cleaning things as much as possible.