Validation

Implementation for #38