rewrite most of dynopoker gem code