refactoring and more config stuff.