 		.set("tagger")
 		.set("target", "targetId")
 		.set("type")
-	@target = (cb) =>
-		@repository.object @targetId, @type, cb
-	return @
-
-<<<<<<< HEAD
+	return @
+Tag.prototype.target = (cb) ->
+	@repository.object @targetId, @type, cb
+
 Gitteh.Remote = Remote = (@repository, nativeRemote) ->
+	_priv = createPrivate @
+	_priv.native = nativeRemote
+	_priv.connected = false
+
 	if nativeRemote not instanceof NativeRemote
 		throw new Error "Don't construct me, see Repository.remote()"
 
-	connected = false
-
 	Object.defineProperty @, "connected",
-		get: -> return connected
+		get: -> return _priv.connected
 		enumerable: true
 		configurable: false
 

		.set("workDir", "workingDirectory")
		.set("remotes")
		.set("references")
	@exists = =>
		[oid, cb] = args
			oid: type: "oid"
			cb: type: "function"
		nativeRepo.exists oid, cb
	@object = =>
		[oid, type, cb] = args
			oid: type: "oid"
			type: type: "objectType", default: "any"
			cb: type: "function"
		nativeRepo.object oid, type, wrapCallback cb, (object) =>
			clazz = switch object._type
				when types.commit then Commit
				when types.tree then Tree
				when types.blob then Blob
				when types.tag then Tag
				else undefined
			return cb new TypeError("Unexpected object type") if clazz is undefined
			return cb null, new clazz @, object
	@blob = (oid, cb) => @object oid, "blob", cb
	@commit = (oid, cb) => @object oid, "commit", cb
	@tag = (oid, cb) => @object oid, "tag", cb
	@tree = (oid, cb) => @object oid, "tree", cb
	@reference = =>
		[name, resolve, cb] = args
			name: type: "string"
			resolve: type: "bool"
			cb: type: "function"
		nativeRepo.reference name, resolve, cb
	@ref = @reference
	@remote = =>
		[name, cb] = args
			name: type: "string"
			cb: type: "function"
		nativeRepo.remote name, wrapCallback cb, (remote) =>
			return cb null, new Remote @, remote
	@createRemote = =>
		[name, url, cb] = args
			name: type: "string"
			url: type: "string"
			cb: type: "function"
		nativeRepo.createRemote name, url, wrapCallback cb, (remote) =>
			return cb null, new Remote @, remote
	return @

Gitteh.openRepository = ->
	[path, cb] = args

	immutable(@, {fetchSpec, pushSpec})
		.set("fetchSpec")
		.set("pushSpec")
	return @

Remote.prototype.connect = ->
	_priv = getPrivate @
	[dir, cb] = args
		dir: type: "remoteDir"
		cb: type: "function"
	dir = if dir is "push" then bindings.GIT_DIR_PUSH else bindings.GIT_DIR_FETCH
	_priv.native.connect dir, wrapCallback cb, (refs) =>
		refNames = Object.keys refs

		# Determine symref for HEAD.
		headOid = refs["HEAD"]
		for ref, oid of refs
			continue if ref is "HEAD"
			if oid is headOid
				headRef = fetchSpec.transformTo ref
				immutable(@, {headRef}).set "headRef", "HEAD"
				break

		immutable(@, {refNames}).set "refNames", "refs"
		_priv.connected = true
		cb()
Remote.prototype.fetch = ->
	_priv = getPrivate @
	throw new Error "Remote isn't connected." if not connected
	[progressCb, cb] = args
		progressCb: type: "function"
		cb: type: "function"

	updateTimer = null
	update = =>
		{bytes, total, done} = _priv.native.stats
		progressCb bytes, total, done
		updateTimer = setTimeout update, 500
	setTimeout update, 500

	_priv.native.download (err) =>
		clearTimeout updateTimer
		return cb err if err?
		_priv.native.updateTips wrapCallback cb, =>
			cb()

Gitteh.Index = Index = (nativeIndex) ->

Gitteh.Repository = Repository = (nativeRepo) ->
	if nativeRepo not instanceof NativeRepository
		throw new Error "Don't construct me, see gitteh.(open|init)Repository"
	_priv = createPrivate @
	_priv.native = nativeRepo

	immutable(@, nativeRepo)
		.set("bare")
