moved stack function into impl of empty stack object