changed to OOP for better readability