Outsourced two functions in analyze, and began on simplify()