Initial threading support
Fix some threading problems
Don't use more than 4 threads by default
More threading
More threading, correct behavior on threads=1