add automatic encoder