Not correct result yet - algorithm fixed