replaced bfCmp with darkf's new version. del whenEmpty