WIP more refactoring