updated for NAN support