Refactored the class for proper OOP usage