diff --git a/include/InputPacketStream.h b/include/InputPacketStream.h
index 34a2e0587ab1c48a31b14f6a1d63d22fee2756cd..38a2548a5afab81e0e20888c315aaf0cc28554cf 100644
--- a/include/InputPacketStream.h
+++ b/include/InputPacketStream.h
@@ -49,12 +49,12 @@ public:
 
     ///It returns the index of the packet type contained in the stream. The stream* contains also the prefix (if present)
     /// \return The index of packet type if it's recognized. 0 if packet isn't recognized.
-    /// \param packet A byte* that contains the packet.
-    int detPacketType(byte* packet);
+    /// \param packet A ByteStream pointer that contains the packet.
+    int detPacketType(ByteStreamPtr packet);
 
 	///It returns the total dimension of the packet contained in the stream (without prefix). The stream* contains also the prefix (if present)
 	///\param The stream with the prefix (if present)
-    dword getPacketDimension(byte* stream);
+    dword getPacketDimension(ByteStreamPtr stream);
 
     /// This method sets the generic input of the stream
     /// \param in An input.
@@ -65,7 +65,7 @@ public:
     /// \return A pointer telemetry packet. Make attention: the object returned is one of the TM packet object of the array of this object. Don't delete it!
     Packet* readPacket() throw(PacketExceptionIO*);
 
-    Packet* decodePacket(byte* stream);
+    Packet* decodePacket(ByteStreamPtr stream);
 
 protected:
 
diff --git a/src/InputPacketStream.cpp b/src/InputPacketStream.cpp
index 3edb07d785a37a5cfb699584f7dedf32746e2202..e6c3231bed5eb71ec9becadcb07ca4828871a488 100644
--- a/src/InputPacketStream.cpp
+++ b/src/InputPacketStream.cpp
@@ -69,14 +69,14 @@ int InputPacketStream::detPacketType(ByteStreamPtr prefix, ByteStreamPtr packet)
 }
 
 
-int InputPacketStream::detPacketType(byte* packet)
+int InputPacketStream::detPacketType(ByteStreamPtr packet)
 {
     /// Iterate through list and output each element.
     /// The packetType 0 is the packet not recognized
     for (dword i = 1; i<numberOfPacketType; i++)
     {
         Packet* p = getPacketType(i);
-        if(p->verifyPacketValue(packet))
+        if(p->verifyPacketValue(packet->stream))
             return i;
     }
     return 0;
@@ -158,7 +158,7 @@ Packet* InputPacketStream::readPacket() throw(PacketExceptionIO*)
     }
 }
 
-dword InputPacketStream::getPacketDimension(byte* stream) {
+dword InputPacketStream::getPacketDimension(ByteStreamPtr stream) {
 		dword dimPre = 0;
 		if(prefix)
 			dimPre += dimPrefix;
@@ -168,18 +168,18 @@ dword InputPacketStream::getPacketDimension(byte* stream) {
 		dword dimHeader = headerReference->getDimension();
 		dim += dimHeader;
 		ByteStreamPtr tempHeader = ByteStreamPtr(new ByteStream());
-		tempHeader->setStream(stream+dimPre, dimHeader, bigendian);
+		tempHeader->setStream(stream->stream+dimPre, dimHeader, bigendian);
 		headerReference->setByteStream(tempHeader);
 		dim += headerReference->getPacketLength();
 		return dim;
 }
 
-Packet* PacketLib::InputPacketStream::decodePacket(byte* stream) {
+Packet* PacketLib::InputPacketStream::decodePacket(ByteStreamPtr stream) {
 
 	int index = detPacketType(stream);
 	if(index > 0) {
 		Packet* p = getPacketType(index);
-		p->setPacketValue(stream);
+		p->setPacketValue(stream->stream);
 		return p;
 	}
 	else