Fixed query not respecting where clause
Fixed TSA relationship
Contract relation now works