Refactoring config reading