refactored dice impl