refactoring to handle configuration options