Improved remote-control code

Improved robustness and quality of the remote-control code