changes to improve and slightly refactor datasource class