add most of the updates to the structure system from the 1.6 branch