Modified to use numpy.asarray instead of numpy.array.