ported to arralloc