type mapping, added unit tests for Map(..), code cleanup