simple Stack datastructure and algorithms