slight refactoring of the encode module