Fix braces, add extra code