adjusted the two corners logic