Renamed some local-scope variables and removed debug code