Refactor/reading config

First part of our feature development, with much refactoring.