Remove unnecessary copying of data and move repetitive code into code generation.
Merge pull request #9 from ianfiske/indexdate-improvements

Remove unnecessary copying of data and move repetitive code into code generation.