Rearrange functions to avoid compilation errors #2