Extracted a helper method
Renamed a method and some variables