Add support for when clauses
Add support for when clauses