complete integration of new cards value function with an additional auxiliary function; renaming some variables; comment old code