Delete redundant curly braces, put flash error in layout