Stopped counting lines myself and used builtin f.lineno.