Simplifying the logic in dynamic routing