Case and function clauses rewritten