refactor zoom code