Updated stack getter function