Refactoring complete (for now)