And wrote a unit test for deleting flows when a referencee is removed