Fixed config file issues, changed functions to use only local variables