cython take2. much simpler, still v fast.