split cleanup into two methods