Fixed boolean refactoring and test