add more logic routing, able to do more complex flag combination