trying to improve line detection