refactors datalayer