added ref enc mode