added a weighted average to make searching steadier

thanks @kaben