added some code around validations