added required validation
used flash messages helper