zmap refactor