Some fixes in edgefilter and refactoring.