clean up and adding precomputation queries for sensor counts