cleaned up code, pan/zoom