finished implementation of map