final code for the class