refactors stack trace