remote_control.c: rearrange the code