Merge pull request #58 from mafintosh/refactor

Refactoring peer discovery