Simplifying some of the scale and pan code