added vectorized versions of functions