Added flash messages and error messages