move validation to a class