added parallelism, couldn't handle 10^14 before