further refactoring