Adds error and flash messages