timegiven good speed up

rewritten, vectorized, 8000x speed up