added functionality to accurately track line position with each change, including new lines