refactoring little bit