adding node hooks.  rearranging functions