Make code more threadsafe friendly.
Merge pull request #5 from bionicpill/step-4

Make code more threadsafe friendly.