No code change, just splitting different states into separate functions.
Attach a file by drag & drop or click to upload