First semi-working encoding