added stack trace to code