Began codec rewrite. Not compiling at this stage.