Recursive branch

implemented recursive branching and the supporting function getParentBranch. Have not heavily tested recursive branching yet