Integrate factorization&abstraction from simulator

Close #6