-debugged some errors and changed the prioritization of sensor events a
bit for more fail-safe threading logic.