Implement a basic encoder