restored pan function