Refactor of zonemap_builder