Correct trigger context, add debug messages.
Remove cruft