Rewritten the getAllClaims function to reuse the db connection