refactor some code about init deck