Finished the refactoring