Finished refactor