rewrote the trash function