Algorithm update

range is slow.