cleaned up the code and implemented better management for zoom levels