Rewrite to use NAN

A lot of internals in V8 and Node.js have changed from 0.10 to 0.11
and higher, causing native addons to break.
The NAN module (https://github.com/rvagg/nan) provides a library to
smoothen out these differences and be able to build native modules
on both 0.10 and 0.11.  This commit re-implements the module using
NAN.