added a function to aid in detecting a stack