Clean up code formatting

Cleanup whitespace and variable/function visibility