Refined the codec and coder framework