Change pop() and contains() to return node, and free memory in main().  Remove const in contains() to avoid compiler warning.