Rewrote the config file handling
Some more refactoring