Completed the build_coder function