added error checking on the mapper, expanded test.