Correct and simplify zooming code