Refactored conversion code

To prep for converting tables to formats other than HDF5.