Got it working, but flaky with big numbers