refactored the data access to its own layer