refactored Die code
refactor die code