improved card class query