passing arrays between functions