added form validation and sychronization