Factorize a little
Add error messages and form validation