adding cleanup part to record part