Improved Discovery performance

Layout still needs some last touches, and I think there might be a logic
error (line 118, I put a TODO)
Merge pull request #7 from nmck257/master

Improved Discovery performance