adding rule logic