Add collectArray method