fix some typos and add utility functions to stack implementation"