Base code for merging dataset and to use lookuptables.
This is necessary for Q3.