Fix receivePacket to only modify parameter when full packet exists
Add inline docs & fix last commit