partial restructuration of the code, add config file