messing with threads
using multiple threads
minor refactor