added some threading capabilities