refactor to work with json config file