updated to use listener for sensor