Refactored node hooks a bit. Before it was always executing one delete query and possibly one insert. Now it only executes only what actually needs to be executed.

Should produce less MySQL traffic.