Fixing mediation insertion

And adding to debug statements for added clarity