Passing array to functions