refactor value stack