clean things up a lot using NAN