Remove unnecessary stacks.