Minor speed improvements. Renamed variables.