new weight algorithm