used map instead of inefficient previous way