Added handling of special cases for quadrants