Improved configuration handling. Moved critical config to config file.