a bunch of miscellaneous renaming, refactoring and cleanup stuff