Refactored out a method for easier reading