Move engine library over to using the new thread API