Style cleanup and minor refactors