Working. Still needs slight clean up in removing references to next blocks that have been deleted. Also does not delete empty blocks.