more thorough checking for vertical stacks before and after