rule and tes functions