more refactoring with yenc class