In a majority of states, custody of a child is determined by