Added Joi validation and conversion.