Mesh generation refactoring. Map is broken for now