Rewrite using hnapi