improved cleanup

Signed-off-by: Henrik Austad <haustad@cisco.com>