kovan-sd: Fix remaining metastability problems
kovan-sd: Re-locate debug code to bottom of file

The debug code should go at the bottom, as it should have access
to as many variables as possible.