Seems to work for weighted algo