Fixed boolean checking
Added test case
Added test case
Refactor: extracted class
Refactor