Add branch_f function