Refactoring and fixed boolean operations
Refactoring
Refactoring