some optimisations in DataSource class