added more intelligent line numbering