supports multiple decks and removal of useless functions