Makes number of threads parameterizable

Closes #6