convert from loop spam to glob and array substitution