Add state logging to default builds
Add complex unit test