deriv and vectorization
argument passing optimization