code for finding the lines is ready.
it tooks 19ms to extract all lines but can be really optimized.