Whitespace
More cleanup.

Use guard style wherever possible, use utility functions for FRE
return values and string extraction.
Clean up header usage
Move utility functions into cpp file
Fix warnings