Add logging and re-write the locking mechanism to use wait for PIDs
Merge pull request #532 from BobBall/parallel-fix

Add logging and re-write the locking mechanism to use wait for PIDs