Add auto line detection