tidy up error handling code formatting
Cascade delete tasks on node delete
add node delete hook to notify agent