anchor.diff:  
   	New()
   		..()
  -		Sort()
  -
  -		if(isplayer(loc))
  +
  +		if(!loc) return
  +
  +		var/T
  +		if(useTypeStack == 0)
  +			T = type
  +		else if(useTypeStack == 1)
  +			T = parent_type
  +		else
  +			T = useTypeStack
  +
  +		if(Sort(loc))
   			var/mob/Player/p = loc
  +			if(p.stackobjects && p.stackobjects[T])
  +				var/obj/stackobj/stackObj = p.stackobjects[T]
  +				stackObj.count += stack
  +				stackObj.suffix = "<span style=\"color:red;\">(x[stackObj.count])</span>"
  +		else
  +			if(isplayer(loc))
  +				var/mob/Player/p = loc
  +
  +				var/obj/stackobj/stackObj
  +
  +				if(p.stackobjects && p.stackobjects[T])
  +					stackObj = p.stackobjects[T]
  +
  +				if(!stackObj)
  +					var/list/items = list()
  +					var/c = 0
  +					for(var/obj/items/same in p)
  +						if(same.useTypeStack == useTypeStack && (useTypeStack > 1 || istype(same, T)))
  +							items += same
  +							c += same.stack
  +
  +					if(items.len > 0)
  +						stackObj = new
  +						var/obj/tmpV = new T
  +						stackObj.containstype = T
  +						stackObj.icon = tmpV.icon
  +						stackObj.icon_state = tmpV.icon_state
  +						stackObj.name = tmpV.stackName ? tmpV.stackName : tmpV.name
  +						stackObj.loc = p
  +						stackObj.contains = items
  +						stackObj.suffix = "<span style=\"color:red;\">(x[c])</span>"
  +
  +						if(!p.stackobjects)
  +							p.stackobjects = list()
  +						p.stackobjects[T] = stackObj
  +				else
  +					stackObj.contains += src
  +					stackObj.count += stack
  +					stackObj.suffix = "<span style=\"color:red;\">(x[stackObj.count])</span>"
  +
  +
  +	Move(NewLoc,Dir=0)
  +		var/T
  +		if(useTypeStack == 0)
  +			T = type
  +		else if(useTypeStack == 1)
  +			T = parent_type
  +		else
  +			T = useTypeStack
  +
  +		if(isplayer(loc) && loc != NewLoc)
  +
  +			var/mob/Player/p = loc
  +
  +			Unmacro(p)
  +
  +			if(p.Lfavorites && (src in p.Lfavorites))
  +				p.Lfavorites -= src
  +				if(p.Lfavorites.len == 0) p.Lfavorites = null
  +
  +			if(p.stackobjects && p.stackobjects[T])
  +				var/obj/stackobj/stackObj = p.stackobjects[T]
  +				stackObj.contains -= src
  +				stackObj.count -= stack
  +				if(stackObj.contains.len > 0)
  +					stackObj.suffix = "<span style=\"color:red;\">(x[stackObj.count])</span>"
  +				else
  +					stackObj.loc = null
  +					p.stackobjects -= stackObj
  +					if(!p.stackobjects.len)
  +						p.stackobjects = null
  +
  +		if(!NewLoc)
  +			loc = null
  +			return
  +
  +		if(Sort(NewLoc))
  +			var/mob/Player/p = loc
  +			if(p.stackobjects && p.stackobjects[T])
  +				var/obj/stackobj/stackObj = p.stackobjects[T]
  +				stackObj.count += stack
  +				stackObj.suffix = "<span style=\"color:red;\">(x[stackObj.count])</span>"
  +
  +		else
  +			.=..()
  +			if(isplayer(loc))
  +				var/mob/Player/p = loc
  +
  +				var/obj/stackobj/stackObj
  +
  +				if(p.stackobjects && p.stackobjects[T])
  +					stackObj = p.stackobjects[T]
  +
  +				if(!stackObj)
  +					var/list/items = list()
  +					var/c = 0
  +					for(var/obj/items/same in p)
  +						if(same.useTypeStack == useTypeStack && (useTypeStack > 1 || istype(same, T)))
  +							items += same
  +							c += same.stack
  +
  +					if(items.len > 0)
  +						stackObj = new
  +						var/obj/tmpV = new T
  +						stackObj.containstype = T
  +						stackObj.icon = tmpV.icon
  +						stackObj.icon_state = tmpV.icon_state
  +						stackObj.name = tmpV.stackName ? tmpV.stackName : tmpV.name
  +						stackObj.loc = p
  +						stackObj.contains = items
  +						stackObj.suffix = "<span style=\"color:red;\">(x[c])</span>"
  +
  +						if(!p.stackobjects)
  +							p.stackobjects = list()
  +						p.stackobjects[T] = stackObj
  +				else
  +					stackObj.contains += src
  +					stackObj.count += stack
  +					stackObj.suffix = "<span style=\"color:red;\">(x[stackObj.count])</span>"
  +
  +
  +
  +	Dispose(sort=1)
  +
  +		if(sort && isplayer(loc))
  +
  +			var/mob/Player/p = loc
  +
  +			Unmacro(p)
  +
  +			if(p.Lfavorites && (src in p.Lfavorites))
  +				p.Lfavorites -= src
  +				if(p.Lfavorites.len == 0) p.Lfavorites = null
   
   			var/T
   			if(useTypeStack == 0)
  
positive.code: 			i.Refresh()
  
  			if(stack <= 0)
  				Dispose()
  			else
  				Refresh()
  
  
negative.code: 
  			if(p.stackobjects && p.stackobjects[T])
  				var/obj/stackobj/stackObj = p.stackobjects[T]
  
  				stackObj.contains -= src
  				stackObj.count -= stack
  				if(stackObj.contains.len > 0)
  					stackObj.suffix = "<span style=\"color:red;\">(x[stackObj.count])</span>"
  				else
  					stackObj.loc = null
  					p.stackobjects -= stackObj
  					if(!p.stackobjects.len)
  						p.stackobjects = null
  
  		loc = null
  
  