Added the stack functionality