         internalData[1] = byte1.lower7bits()
         internalData[2] = byte2.lower7bits()
 
-        length = 3
-        internalData = Array(internalData[0..<3])
+        setLength(3)
 
     }
 

        case .songPosition:
            internalData[1] = byte1.lower7bits()
            internalData[2] = byte2.lower7bits()
            length = 3
        case .songSelect:
            internalData[1] = byte1.lower7bits()
            length = 2
        default:
            length = 1
        }
        if let existingLength = length {
            internalData = Array(internalData.prefix(Int(existingLength)))

                        break
                    }
                }
                setLength(computedLength)

            } else {
                if let cmd = packet.command {
