first version of line detection