modified to read config file