add a stack implementation and a apply