Refactor display and deal functions