Finish up refactoring, ready to merge!