Large cleanup (and ensuring we use curly braces everwhere.)