some changes to get the full algorithm
complete algo for duplexp3