Added parameter to set occupancy threshold.