changed API to define validation messages