Rewrote sensor handling.