Refactored the ear clipping code (and one method of Line) for legibility