Rearrangement of functions for clarity.