Add support for common facilities & lots of restructuring

Restructured quite a bit of the code, move lots of computation to SQL instead of doing it manually in Python, good for speed and less code.

Option parsing is done with optparse instead of doing it manually.

Largest feature addition is that of finding common facilities between two networks. Would be nice to find "close" facilities (ie, by coordinates) but that's quite a bit more work.

I could possibly break this up into smaller PRs but I hope you love all that code =)