Minimize API surface; fix encoding