updated heightmap code