Yes I did it! I finally managed to catch the cycle at the end! I think future improvement will be quite small since this seems quite optimized now.