remote control code refactoring