It is not really apparent n your post what the actual data and looks look like, but would it make more sense to dump this data in a database like mysql or postgres and then have the lookups defined as SQL? That way (of course depending what the actual lookup needs are) you could have one SQL statement for each type of lookup. I am thinking something like what you state is your cross reference list that changes may easily fit into a SQL join or subselect. Could you post an example of the dataset and the types of lookups you are doing (with expected results from the example set). This should give us a better understanding of the actual problem and you better output from us.