added z threshold and light idicator