refactor Stack