rearrange function clauses to kill compiler warnings
complain nicely if all nodes aren't present