Renamed some variables, it should be more readable now