Do proper form invalid errors
Switch from private to protected visibilities
Remove global vars, use dependency injection