Fixed the class Protocol, added a new set of algorithms to solve the problem, now it can deal with recursive messages.