Factor out stacktrace extraction into function
Merge branch 'master' into wrap-functions
Work in progress