Refactorized code: Moved trivial unifications to the head.
Avoiding lambda expression (Ulrich style)