encoder first