Working on marriage algorithm