Repaired logaritmic algorythm