added modified logic