delete this, use ArrayCollection(result).length directly in for