updated nH package, changed register di, optimized code