doing some good refactoring