Use multi-threading

Fixes #3.