Added more validations and formatting for error display