Improve the structure of StackDump

I wanted to make the code cleaner.