move map generation logic into map class