logic function impl