the code of LinkStack