Modified code for class assignment