Refactored the class