OE-2739   optimized the logic