Small fixes.
Massive changes and introduction of map() to simplify unittests. Also introduced multimap.