Added some threading related stuff