refactor method in database from public review