Validation

Implementation for #38
Also, this indented 1 level too few