safety commit

Refactored code to allow fields to be regrouped into new orders. This
commit still contains changes that were stable after the previous
commit but prior to these changes.