start a bit of a refactoring