refactoring panning code