Added stub code for threading stuff.
Many much bugs squashed.
Woops, added new file.