refactor to reduce list of arguments needed for encoder/decoder