code refactors, minor style tweaks