Mostly refactors