Fix panning and cleanup