updated cleaning code