Rewrote line following to make concise, functionality preserved