Harder algorithm