moves map-head to map; refactors for loops