Second implementation with newline edit