Add better handling of configuration file