Use logical operators to shorten implementation