Minor code tweaks

Small stuff.  Mostly rearranging the order of stuff (functions before classes, pseudo-private classes first, etc.).