Refactored converter : separated the validation and conversion Logic