use map::find instead of a for loop