tidied up conditional clauses