adaptArray function need testing