Mostly refactoring...I think