Finish refactoring