Add documentation and make checkStack() polymorph