Code refactor & js email input validation.