Code cleanup in clearing.