Bug fixes and first code for a map generator.

Signed-off-by: Jan Ekholm <jan.ekholm@d-pointer.com>