validation and change in redirection function