code cleanup and zoom/scale issues