Renamed a variable and a method
Changed loop condition
Renamed variable and introduced an explaining helper
Renamed some variables