changes made to code after checking validation