use map instead of array