Updated ZNC clear query logic