REF: Reordered functions so that it makes more sense.