vectorized as suggested :)