Reworking Deck logic, plus tests.