refactoring things a little bit