added NAME and STATS options to query