A method of forming an ad-hoc network from a group of terminals (L, M1 - M5) among a plurality of terminals, comprising, at a said terminal: in an initial state of being configured to perform wireless communication via a base station, receiving an emergency code from the base station; reconfiguring one or more settings of the terminal in response to the emergency code; searching for other terminals in the vicinity and exchanging capability data with terminals found in the search; comparing the terminal's capability data with capability data received from the found terminals, by calculating, on the basis of the capability data, a score for the terminal itself and each other terminal with which capability data has been exchanged, to form a list; and if the result of the comparison indicates that one of the found terminals has a greater capability to be leader of a group of terminals: requesting to join with a found terminal in a group (L, M1 - M5) with the found terminal acting as leader of the group, the terminal performing said requesting to each other terminal in the list scoring higher than the terminal itself, for each said other terminal in turn and in order of the highest score first; and if the request is accepted, performing wireless communication via the leader terminal instead of via the base station; otherwise: receiving a request to join a group as the leader of the group; and confirming acceptance of the request and performing wireless communication via the base station on behalf of each other terminal (M1 - M5) in the group. in an initial state of being configured to perform wireless communication via a base station, receiving an emergency code from the base station; reconfiguring one or more settings of the terminal in response to the emergency code; searching for other terminals in the vicinity and exchanging capability data with terminals found in the search; comparing the terminal's capability data with capability data received from the found terminals, by calculating, on the basis of the capability data, a score for the terminal itself and each other terminal with which capability data has been exchanged, to form a list; and if the result of the comparison indicates that one of the found terminals has a greater capability to be leader of a group of terminals: requesting to join with a found terminal in a group (L, M1 - M5) with the found terminal acting as leader of the group, the terminal performing said requesting to each other terminal in the list scoring higher than the terminal itself, for each said other terminal in turn and in order of the highest score first; and if the request is accepted, performing wireless communication via the leader terminal instead of via the base station; otherwise: receiving a request to join a group as the leader of the group; and confirming acceptance of the request and performing wireless communication via the base station on behalf of each other terminal (M1 - M5) in the group. requesting to join with a found terminal in a group (L, M1 - M5) with the found terminal acting as leader of the group, the terminal performing said requesting to each other terminal in the list scoring higher than the terminal itself, for each said other terminal in turn and in order of the highest score first; and if the request is accepted, performing wireless communication via the leader terminal instead of via the base station; receiving a request to join a group as the leader of the group; and confirming acceptance of the request and performing wireless communication via the base station on behalf of each other terminal (M1 - M5) in the group.