add validation and json serialization methods