more thread safe, quit actually works
Merge pull request #4 from bencentra/master

more thread safe, quit actually works