use map and add tests