The genetic and cellular basis of viviparity