Re-arranged some code to better match AL-39, but no behavioral changes.