Fix up the order of functions.

Previously class methods are surrounded by general (non-class)
functions. This patch packs the non-class functions above the
class methods.