If it works why mess with it? What needs improved?
I would use the state change detection method to send the code only one time when the button becomes pressed.
I would use an active low switch (switch wired to ground). That is the more accepted way of switch wiring. See my state change detection tutorial for using state change detection with an active low switch.