Add in factorization function.
Ensure nothing's unchecked.
Implement some factorization tests.