refactoring to make things easier to read