Update method to detect branch.