added z dir. added variable to adjust the level and mapping range value.