began line basic algorithm