Move interface code out of client_main