Javascript validations done right