refactored. built-in stack was removed