converted stack to use dynamic nodes