Refacto for handling multiple datasource types