Rewrite lib/index.js