Renamed a few variables to avoid confusion