Slight simplification of code
fixed bug in previous commit
changed to a stack based unification algorithm