Refactoring for cleanup