Renamed some variables to avoid conflicts and confusion.