Trim stack trace.

This is just some ideas I had for fixing #669. I haven't written tests yet; just wanted early feedback.

The above two lines can be replaced with a call to `getTrace()`.