add new rule functions ad db functions by Fang danli