Finished refactoring