Fixed PC race conditions in tests, simplified tests.

Fixes GitHub issues #19 and #20.