Rewrite Encode to imported subroutines.
Sort languages.
Add new tests.