Added logic to boolean functions