also changed the foreign master table adding and agging and some minor adpatations in state pre-master