Add the rest of an almost-working test
Do some refactoring and docs about debugging info