Major changes to instances (and a few other unrelated things). Need to fully debug this; basically fixes a whole bunch of inconsistencies with instances.