That is the algorithim. You can actually hang the algorithim if you don't let it finish removing and placing blocks, causing it to constantly remove and replace blocks at the 'edge'