reduced a bit the number of variables
cleanup, rinse, repeat
partial implementation of factorization
cleanup