removing trash and optimizing