Added debugging commands to Relations extension and tidied up a couple of other things