added getbranch function