Moved the stack printing to a better place