Threading implemented

which was a bitch...