refactor to support outbound rules