increased speed of scaling window with numba and refactorization