added -i flag to grep for all queries (-q)