Re-order functions to match order of declaration in header.
Fix some comments.