Tweaked formatting for function, add if formatting

The block inside a function declaration has a different formatting semantics than the normal block. Updated the formatter to take this into account.