Code is now multithreaded.

There's still something wrong with reading from ir sensors (or else with
handling that information), but the code structure is correct.