refactoring for my needs