Revised with correct code in class