refactoring data access methods.