rearranging stuff for refactoring