Add a design specification & refactor some code

There are no tests for the current refactoring and tests don't even
compile. There is already some developer documentation for the parts
that were refactored. There are also TODO comments to see the parts
where work is needed. First of all, the tests for test_configuration
should be finished to ensure all configuration refactoring worked.