working on some speed optimization with Numba.