Added programmatic arming and mode setting.