Minor improvement to GetEntityAt and GetEntityCloseTo functions