Changed CheckoutBranch back to IntPtr and updated relevant code.