Keep threads from interfering with each other.
Merge pull request #150 from hoangelos/master

Keep threads from interfering with each other.