Changed update algorithm