Fix threading issues

Fixes #9
Improve examples using Port::iter
Merge pull request #13 from bjz/thread-safety

Fix threading issues