Rearanged some classes and functions