-- NAME_PLATE_UNIT_ADDED NAME_PLATE_UNIT_REMOVED FRAME_UPDATE
function(states, event, unit, ...)
	if event == "NAME_PLATE_UNIT_ADDED" and unit or event == "NAME_PLATE_UNIT_REMOVED" and unit then
		if UnitExists(unit) then
			local isPvp = UnitIsPVP(unit)
			local nameplate = C_NamePlate.GetNamePlateForUnit(unit)

			states[unit] = states[unit] or {}
			states[unit].unit = unit
			states[unit].frame = nameplate
			states[unit].changed = true
			states[unit].show = isPvp
		end
	elseif event == "NAME_PLATE_UNIT_REMOVED" and unit then
		states[unit] = states[unit] or {}
		states[unit].unit = unit
		states[unit].show = false
		states[unit].changed = true
	elseif event == "FRAME_UPDATE" then
		local theTime = GetTime()
		if not aura_env.last or aura_env.last < theTime - 0.2 then
			aura_env.last = theTime
			for i = 1, 40 do
				local unit = "nameplate" .. i
				if UnitExists(unit) then
					local isPvp = UnitIsPVP(unit)
					local nameplate = C_NamePlate.GetNamePlateForUnit(unit)
					states[unit] = states[unit] or {}
					states[unit].unit = unit
					states[unit].show = isPvp
					states[unit].changed = true
					states[unit].frame = nameplate
				end
			end
		end
	end

	return true
end
