The SDM version of the above function is more complex than the CHDK version because of its support for Chinese wireless doorbells (!), fast shooting on switch press and various stereo features.
Nevertheless, the CHDK version could be far simpler.
To developers who may not be aware of the earliest days of CHDK and SDM development, you need to understand why certain features were in the SDM version that CHDK copied.
Zooming with the remote is simply to synchronise zoom on multiple cameras, of little value with a single camera.
Movie stop/start with the remote is again for controlling multiple cameras (though attaining precision synch is an unsolved goal).
Other parts of the code are to ensure precision synch of multiple cameras when the switch is RELEASED.
Of no value whatsoever for single cameras and slows the shooting response.
Personally, I would simplify the CHDK code considerably.
David