Complete refactoring