Renamed variables. Swapped some code around for consistency.