Algorithm improvements