Match validations.
Don't rely on global var.
Implement validation.
Remove unnecessary code.