cleaned up heightmap generation code