Return a function instead of array