introducing boolean and refactoring