Updated checkIfEmpty procedure.