Testing and simplifying configuration handling

 - Added a bunch of unit test for configuration handling code
 - Finalize all the things