refactored classes and made configurable