added instantation of classes and modified comparator