rewrite some conditionals as separate clauses
conditionals were too ugly and complicated (see commit 414cdeb5)