Final version. Added column name expansion.

Added a function to expand column names.
Reqrapped every thing into a function, so that all of the intermediate
data structures are closed over.