Clean up demo, keep track of per-term offsets into u