changes to work with a stack