fix closure/this issues with dealing cards
update table functions / fix tests
re-org some files