Refactor wavepacket struct and change wavepacket pointer cast to bytes packing