Heaps for error correction and the geometry of non-linear loop-transversal codes