validation

Implementation of validation idea from #3