Corrected conditional logic.