Updated code to use config file