expand arrays in function