Purely cosmetic: reorder some function, tweak comments.