refactor for database access methods