Finally fixes #90. Need a bit of cleanup for debug code.
test