cleanup function.  logging should be debug