Assorted cleanups to conditionals, pattern matching, doc-comments and formatting in core