various cleanups, started on gauche client