Config file is no longer saved if it's not necessary
Some refactoring