reworking shit for encoding