Implemented optlogfact. Still not optimal, I've thought another approach. I'll implement it tomorrow :D