Better algo, works better but not as expected