Big refactor to auto configure based on config file.