encoding for rules