Added forked code from http://peers.sourceforge.net/