removed duplicate calculation of temp_y (previously temp)