tweaking for better variable naming, and smaller headers in codebook