Optimization to the logic
Optimization to the logic
Removed redundant classes and simplified the logic