The lines stuck together as "nn" didn't work.
Changed code from "nn" to "/n/n" and it is fine.
This file contains the whole new script. Works great.

More...