1) name the simple functions get_foo and set_foo (and make them more consistent e.g. set_rd_mode and get_rd_mode). 2) moved remaining simple queries from main.c into query.c 3) created separate query.h header and included it in main.c 4) implemented get_usb_mode (they do not have this in the proprietary flasher) and added this function to a normal run (-> you will see the current USB mode when running with -i)