lol refactoring... because networkx sucks :)
merge: didn't pull le Svens fixes but commited refactoring