More refactoring. Just before breaking stuff