Hough transform and refactoring