Refactor to dynamically configure backends