refactor stack, added node, fixed compile errors