deep copy of lines and better detection of change