Cleanup trailing spaces, add remote_cmd function.