Some simple factorization code