Evolution of sex determining mechanisms