Adds cleanup, context mgmt and patches test.
Merge pull request #20 from lukecampbell/thread_manager

Adds cleanup, context mgmt and patches test.