Revert "Refactor with Line object"

This reverts commit 56c8ba999dd63a2a4a2a0044c158065423b27a18.
Revert "Revert "Refactor with Line object""

This reverts commit 450c5ab700b7c3521112cd1933e9a3e4dbee4e7a.