Changes needed to allow independent instances to run on seperate threads

This ran fine using workflow 1.0 and valgrind gave it a clean bill of health.