add some code of extracting line
need further debugging