refactored the code a little especially in the config file