updated function to deal with config struct