Multithreading support

Hi =) This is a pull request to merge my changes into your repository. Let me know if you receive that.