Move around code so user-facing functions appear first