Moving the logic around so it's not in the way.

It makes more sense to do the logic first before outputting anything,
obviously.