consolidate before end to before {}