changed all braces such that they are on the same line as the function definition, so that folding is easier to use