adds validation functionality on update