refactoring config and initialization