Added multi-thread capabilities