refactored all of the things