Trouble with Spawning props code.

Hello everyone.

im having a hard time with the piece of code below, the idea is to let it spawn an entity but before its spawns the item at the given vector it needs to check if the entity isnt already there.

Here is what i got so far:



function SpawnTerminal(position, angle)
    local orgin_ents = ents.FindInSphere(position,5)
    for _,v in pairs(orgin_ents) do
        if v == "an_terminal" then
            v:Remove()
        else
            local ent1 = ents.Create("an_terminal") 
            local ang = angle;
            print("
[A] Terminal Spawned: " .. tostring(position))
            ent1:SetAngles(ang)
            local pos = position
            pos.z = pos.z - ent1:OBBMaxs().z
            ent1:SetPos( pos )
            ent1:Spawn()
        end
    end
end

function SpawnProps()
    SpawnTerminal(Vector( 8841, 4167, -7770 ), Angle( 0, 0, 0 ))
end

hook.Add("InitPostEntity","SpawnTheProps",timer.Simple(1,SpawnProps))


the piece of code doest spawn the actual entity, but it spawns the damn thing like 6 to 7 times.
Where did i go wrong?

Thanks in advance!
Siniq