modified script slightly to account for 0 sensors