Added a implementation for the factorization stuff