Some refactoring according to suggestions of hlint.
Overall refactoring.
Implemented filterWeights (and according to that filterEdges) everywhere.
Overall refactoring.