refactering data access.