Add missing brace and add some perf improvements