Misc refactoring/clean up