refactoring and adding configuration