added boolean logic