First pass at adapted unification algorithm