Added threaded implementation
Merge
Multi-threading works fine now. Added comments.