handle multiple branches