Refactored the code into many more classes