Node.join functionality is iterative

The previous approach was a recursive approach. The problem is that
with enoug retries, you will get a stackoverflow. With an iterative
approach this won't happen.

Also improved the logging a bit so it included the attempt number.