Add function to intelligently create arrays.