added naive implementation of map. added testing option to override native functions