There were six copies of identical nontrivial code. Put it into a function.
Attach a file by drag & drop or click to upload