final version for class