This is a merge from the "theoryfixes+cdattrhash" branch. The changes