Refined map generation algorithm