Change API to allow reusing of arrays (to eventually reduce GC load, and
factor caches differently)