Split off remove op into method and tidy up debug output.