Added multithreaded support for interfacing with hardware