Refactor config handling heavily

Change-Id: 5f57ef0f29
wip [ci skip]

Change-Id: 22b0d4f36c