better conf handling and refactoring