Switch from manual byte[] conversions to marshaling