Introduced proper relationship between activities and objects (via non-JSON foreign key).
Attempts to address #1052.