refactored map generation into a helper class