More refactor

Crazy refactorings.