Refactoring lots of stuff.