Is there an easier way to do all of this?

See reply #1 and #3.

I'm bouncing between phone and tablet, but machines with dev software are out of reach at the moment.
Maybe someone else will dive in.