Add remove-empty-nodes function.