Refactored the classes to reduce the size