added tests and made factorization concurrent