added real threading. currently 5 threads