Looks good, except you might want to set the timer before calling remote_shell_input()...