Major refactoring of data access classes