Fixes #1 where a race condition could lead to an infinite loop.

Changed some log levels and added a shakedown test.