improve the class to use more boolean operator