reorder functions for readability