Stripped trailing lines

Also created the python program to automate this.