Fixed formatting

Moved all braces so that they are on their own lines and removed the trailing whitespace after function declaration;