Feature join and leave

I merged my version for peer joining and leaving. 
I made routing table to use dictionary instead of list.

@hakonamatata @ollandos : Can you check red lines to make sure that I did not delete your changes.