- refactor some code for line counting