Still with plenty of repeated code to be factored out.
Attach a file by drag & drop or click to upload