change object to class with constructor