Implemented map, tidied up tests.