Added more debugging logs.
Replaced all usages of string/size char*/size by ByteArray.