build intermediate table model