slightly optimize panning