Finish up refactoring