refactor stacks.