diff --git a/README.md b/README.md
index 71296eead392d1f4d181c1106f99f72db3109214..280bd5dd11c068f86f22cd435ef8adb025467423 100644
--- a/README.md
+++ b/README.md
@@ -9,18 +9,14 @@ Linux. curl. fish. awk. One mp3 player available on command line.
 
 打开微信 微助教 学生 答题,关闭wifi,按住页面选择在浏览器打开,然后复制下这个页面的url。
 
-编辑d.fish,将url填入set \_url "YourURLHere"。
+编辑daemon.fish,将url最后的openid填入set \_openid "YourIDHere"。
 
-./d.fish 它会每5秒检查一次并判断是否需要答题。
+./daemon.fish 它会每5秒检查一次并判断是否需要答题。
 
-d.fish使用了gnome的notify-send,kde/其他de用户请根据自己的情况选择修改或删除气泡提醒。
+daemon.fish使用了notify-send,其他用户请根据自己的情况选择修改或删除气泡提醒。
 
-d.fish默认使用mpg123/cvlc来播放mp3,其他播放器用户请根据自己情况进行修改。请将电脑声音调大。
+daemon.fish默认使用mpg123/cvlc来播放mp3,其他播放器用户请根据自己情况进行修改。请将电脑声音调大。
 
 ## Tips
 
-使用./informed.sh来停止一次提醒。
-
 根据经验,url一般会在1-2小时后失效。因此请在课前获取url启动脚本并睡觉。你可以使用juice ssh或超级本在床上完成这一过程。
-
-警惕以下情形: 老师发出一个题,脚本发出警报,你成功答题,老师在第一个题过期之前发出第2个题,你不知道。
diff --git a/badid.mp3 b/badid.mp3
new file mode 100644
index 0000000000000000000000000000000000000000..f8d3c42c5097fdd088ce73fbafb899c8ca47690e
Binary files /dev/null and b/badid.mp3 differ
diff --git a/d.fish b/d.fish
deleted file mode 100755
index 8a6c965c475a87f45965788ca56cf506f0adf074..0000000000000000000000000000000000000000
--- a/d.fish
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/usr/bin/fish
-#Usage: fill _url with url of the page "学生->答题".
-#You must `echo "known" > /tmp/gay_known` to tell the script that you've been informed.
-
-set _url 'https://www.teachermate.com.cn/wechat/wechat/guide/answer?openid=0a26740fbf9429d1747f8bc8ff8bf1cb'
-
-set _audio_player "mpg123"
-#set _audio_player "cvlc --play-and-exit"
-
-function _is_informed
-    # May not exist.
-    if test (cat /tmp/gay_known 2>&1) = "known"
-        echo "LOG> skipped because informed."
-        return 0
-        # ok.
-    else
-        echo "LOG> not informed. Launching cvlc."
-        return 1
-    end
-end
-
-function _on_opened
-    if _is_informed
-        return 0
-    end
-    eval $_audio_player fire.mp3 > /dev/null 2>&1
-    notify-send "Warning: Question opened!" "Gay question opened!"
-    echo "LOG> Detected!"
-end
-
-function _on_error
-    eval $_audio_player error.mp3 > /dev/null 2>&1
-    notify-send "Warning: Gay cookie invalid!" "Gay cookie expired!"
-    echo "LOG> Error occurred! Maybe invalid cookie."
-end
-
-function _on_notopen
-    if not test -e /tmp/gay_known
-        return 0
-    end
-    if not rm /tmp/gay_known
-        echo "WARNING::::::: UNABLE TO REMOVE /tmp/gay_known. Please deal with this programming error immediately!!!!!"
-        _on_error
-    end
-end
-
-while true
-    set _status (curl "$_url" 2>/dev/null | awk -f gl.awk)
-    date
-    if test "$_status" = "OPENED"
-        _on_opened
-    end
-    if test "$_status" = "UNKNOWN_ERROR"
-        _on_error
-    end
-    if test "$_status" = "NOT_OPENED"
-        _on_notopen
-    end
-    sleep 5
-end
-
-    
diff --git a/daemon.fish b/daemon.fish
new file mode 100755
index 0000000000000000000000000000000000000000..6be0f2ceba05fc1c75e56daa8e952a11527c5688
--- /dev/null
+++ b/daemon.fish
@@ -0,0 +1,85 @@
+#!/usr/bin/fish
+#Usage: fill _url with url of the page "学生->答题".
+#You must `echo "known" > /tmp/gay_known` to tell the script that you've been informed.
+
+set _openid '593712dbd06b5808e4d4a099e8ad4c8d'
+set _url "https://www.teachermate.com.cn/wechat/wechat/guide/answer?openid=$_openid"
+
+set _audio_player "mpg123"
+#set _audio_player "cvlc --play-and-exit"
+
+function _check_and_warn
+    if _all_answered
+        echo "LOG> exit because all question answered."
+        return 0
+    end
+    eval $_audio_player fire.mp3 > /dev/null 2>&1
+    notify-send "Warning: Question opened!" "Question opened!"
+    echo "LOG> Detected!"
+end
+
+function _on_unknown_error
+    eval $_audio_player error.mp3 > /dev/null 2>&1
+    notify-send "Warning: Error occurred!" "Error occurred!"
+    echo "LOG> Error occurred!"
+end
+
+function _on_openid_error
+    eval $_audio_player badid.mp3 > /dev/null 2>&1
+    notify-send "Warning: Invalid openid!" "Error: Invalid openid."
+    echo "LOG> Invalid openid."
+end
+
+set _tmp_path "/tmp/._teachmate_fucker_html"
+
+set awk_urlfilter '
+BEGIN {
+    start = 0
+}
+
+{
+    if (match($0, "以下课堂包含开启的题目")) {
+        start = 1
+    }
+    if (match($0, "以下课堂暂未开启题目") != 0) {
+        exit
+    } else if (start == 1) {
+        print $0
+    }
+}
+'
+
+function _all_answered
+    # This function will return true if no question is opened, so OPENED check is unnecessary.
+    for class in (cat $_tmp_path | awk $awk_urlfilter | grep 'www.teachermate.com.cn' | sed 's/.*course_id=//g' | sed 's/&open_id=.*//g')
+        curl --header "openId: $_openid" "https://www.teachermate.com.cn/wechat-api/v1/questions/$class" > $_tmp_path 2>/dev/null
+        if not grep 'question' $_tmp_path
+            echo "ERROR> curl wechat-api failed. $class $_openid"
+            _on_unknown_error
+        end
+        if grep '"isAnswered":0' $_tmp_path
+            # return false
+            return 1
+        end
+    end
+    # return true
+    return 0
+end
+
+# main loop
+while true
+    date
+    curl "$_url" > $_tmp_path 2>/dev/null
+    # network error will be reported by isopen.awk.
+    set _status (cat $_tmp_path | awk -f isopen.awk)
+    if test "$_status" = "UNKNOWN_ERROR"
+        _on_unknown_error
+    else if test "$_status" = "OPENID_ERROR"
+        _on_openid_error
+    else if test "$_status" = "OPENED"
+        _check_and_warn
+    end
+    sleep 5
+end
+
+
diff --git a/informed.sh b/informed.sh
deleted file mode 100755
index 3fd83a7c50aaf3c57578ffe4c5e7650102fc5376..0000000000000000000000000000000000000000
--- a/informed.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/usr/bin/sh
-echo "known" > /tmp/known
diff --git a/gl.awk b/isopen.awk
similarity index 60%
rename from gl.awk
rename to isopen.awk
index d891a0203f4387a7edafc5f0d207c4b515589fe2..6484430e5a888c664051219d133763e449d1fe59 100644
--- a/gl.awk
+++ b/isopen.awk
@@ -1,36 +1,42 @@
 #!/usr/bin/awk
 
+# Meaning of a: 0-2: check END{}
+#               4: 
+
 BEGIN {
-    a = 0
+    a = 999
 }
 
 {
     if (match($0, "\"msg\":\"unauthorized\"") != 0) {
-        a = 999
-        exit 2
+        a = 2
+        exit
     }
     if (match($0, "以下课堂包含开启的题目") != 0) {
         a = 1
-        exit 1
+        exit
     }
 
     if (match($0, "以下课堂暂未开启题目") != 0) {
-        a = 1
+        a = 0
     }
-    if (a == 1 && (match($0, "概率统计-计算机1601-4") != 0)) {
+    if (a == 1 && (match($0, "single-line\">编号:") != 0)) {
         a = 2
-        exit 0
+        exit
     }
 }
 END {
-    if (a == 2) {
+    if (a == 0) {
         print "NOT_OPENED"
         exit 0
     } else if (a == 1) {
         print "OPENED"
         exit 1
+    } else if (a == 2) {
+        print "OPENID_ERROR"
+        exit 2
     } else {
         print "UNKNOWN_ERROR"
-        exit 2
+        exit 3
     }
 }