refactoring further