ok better lineno algorithm