speedup and cleanup