refactor logical ops