Hi,
Ah okay, now I see what you try to do. Your updated code snipped looks fine to me. Now, implementing a routing mechanism like the Dynamic Routing mentioned in the paper should be pretty straight forward.
Regards,
Unity05