Reorder functions: First read, then write functions