Make Config factory more generic