Remove a lot of obsolete code

When changing the order of the triggers in the output I realised there was some obsolete code lying around and still being used in small portions.  This is removed and the places where it's used updated to point to the newer code.