finish stack implementation