added old Algorithm