adding getBranches function