refactor stack to use linkedlist