Rotating gear mechanism