Refactored line, rectangle and ellipse modes