added finaliser clause to class definitions