massive refactoring and addition of configuration