Merged multi-threading into master branch