Configuration refactor

May not be ready yet... please review