Added unique factor count function