Only encode once in remove_node

Addresses #5