Version before changing to better algo.