complete function 'branch'