Refactor edge detection methods.