smart cleanup