Multi threading

Multithreading works fine, merging back into master so I can make a new branch for the next feature.