codec rewrite step 1, now doing it TDD way