Creating array expansion code