A rewrite of QuarryPlus.