adding support for nested rules