Refactoring, renaming, and cleanup