Working on a better javascript validation