refactored the unification implementation. More work needs to be done.