Added (lame) multithreading and fixed a major bug in sampling of training words.