use interface embedding
add Encoder
update visibility for types and functions