changes to handle concurrency

and a couple of small bug fixes
tested on Bob, looks like its working. more tests tomorrow
Requires prism update and recompilation