Changed the z-index processing to prevent overlaps from changing