Add function to modify stack trace

I've often found that some wrapping code I've been working with has added noise to the stack trace. This PR adds the ability to set a function that can tidy up the trace removing anything that's "junk".