REFACTOR add encoding