add build-map function