changed functions to classes