refactoring ready for routing