fully generalized from wild jokers website