Added local map generation. Untested code.
Bugfixes