Refactored data access to use services