adjust algorithm