modified logic