Add comments to terrain layer code