Configuration refactoring

cc @dahlbyk