replace each with map and select