refactoring to make everything tidier