Added multi-thread support and changed loop timer to use chrono