move a few functions to utils.go
flattenBytes()
type conversion