Refines config file and adds error checking for config file