slight further refactoring