Refactored code into classes, making it much easier to use and read