A prime minister will resign after party defeat at an election if unable to form a coalition, or obtain a confidence and supply arrangement. He or she may also resign after a motion of no confidence in the prime minister or for personal reasons. In such cases, the premiership goes to whoever can command a majority in the House, unless there is a hung parliament and a coalition is formed; the new prime minister will by convention be the new leader of the resigner's party. It has become the practice to write the constitutions of major UK political parties to provide a set way to appoint a new party leader.