Replaced error variable with flashed messages