Added clean and gc functions