Refactoring to make things easier to understand