Initial working code, with buggy sensor handler.