improve line search by applying regex only when necessary
add comments (and fix typo)
Merge pull request #380 from davidsulc/improvements

Improvements