Add some comments and change the double pointer of a function parameter to single pointer which is used to print stack.