Rewrite configuration system

This commit refactors almost all of the configuration section to make it more friendly for further development. In addition, files being saved without comments has been fixed.

 Emphasis has been put on retaining backwards compatibility, so most actual configuration options in flatfile have stayed the same. Minor changes are automatically upgraded.