refactor to decode hex in ObjectId
refactor to use ByteArrayBuilder in Tree