Generalized extend so that it is more generally useful outside of fusion and vectorisation.