add nested rule code