implemented line-first