Added backtrace generation and formatting