multithreading works (code is crap however)