move encoding where it belonges