Refactoring; many new configuration parameters and documentation