Refactored js an added enhanced validation for email
Updated index