defined validation

Okay, tear it apart :)
Also, the `case` and `when` should have the same indentation level